﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace SpriteGame.Entities.Actors
{
    public enum WeaponTypeEnum { Magnum, UZI, MP7, AK47, REC7, M1A, Shotgun, MiniMe };

    class WeaponHelper
    {
        private static WeaponHelper instance;
        public static WeaponHelper Instance
        {
            get 
            {
                if (instance == null)
                    throw new Exception("Weapon Helper Not Initialized");
                return instance; 
            }
        }

        private Dictionary<WeaponTypeEnum, Weapon> weaponDict;

        public static void Initialize(ContentManager _content)
        {
            instance = new WeaponHelper(_content);
        }

        public WeaponHelper(ContentManager _content)
        {
            weaponDict = new Dictionary<WeaponTypeEnum, Weapon>();

            weaponDict.Add(WeaponTypeEnum.Magnum, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 2, new Vector2(72, 106), 1, WeaponTypeEnum.Magnum));
            weaponDict.Add(WeaponTypeEnum.UZI, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.UZI));
            weaponDict.Add(WeaponTypeEnum.MP7, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.MP7));
            weaponDict.Add(WeaponTypeEnum.AK47, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.AK47));
            weaponDict.Add(WeaponTypeEnum.REC7, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.REC7));
            weaponDict.Add(WeaponTypeEnum.M1A, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.M1A));
            weaponDict.Add(WeaponTypeEnum.Shotgun, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.Shotgun));
            weaponDict.Add(WeaponTypeEnum.MiniMe, new Weapon(_content.Load<Texture2D>(@"Textures\SpriteAnimations\Abe\Arm"), 1, new Vector2(8.44f, 10.48f), 1, WeaponTypeEnum.MiniMe));
        }

        public Weapon GetWeapon(WeaponTypeEnum _weaponType)
        {
            return weaponDict[_weaponType];
        }

    }
}
